package com.fwj.user.dao.user;

import com.fwj.user.entity.user.UserBaseInfo;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

/**
 * @Author: fwj
 * @Data: 2021/12/18 11:24
 * @Version 1.0
 * @Description:
 */


public interface UserBaseInfoMapper extends Mapper<UserBaseInfo> {

    /**
     * 根据用户编码查询用户基本信息,有_线的字段加别名，不然查不出数据，mybatis对驼峰命名法适配不好
     * */
    @Select(value = "SELECT " +
            "id, " +
            "number, " +
            "nick_name nickName, " +
            "image, " +
            "is_show isShow, " +
            "sex, " +
            "birthday, " +
            "address, " +
            "school, " +
            "occupation, " +
            "personal_profile personalProfile, " +
            "create_time createTime, " +
            "update_time updateTime, " +
            "status " +
            "FROM user_base_info where " +
            "1=1 " +
            "and number = #{number} " +
            "and status = #{status} " )
    UserBaseInfo findUserBaseInfoByUserNumber(Long number, String status);

    /**
     * 查询用户个人界面信息
     * */
    @Select(value = "SELECT " +
            "number number, " +
            "nick_name nickName, " +
            "is_show isShow, " +
            "sex, " +
            "birthday, " +
            "address, " +
            "school, " +
            "occupation, " +
            "personal_profile personalProfile " +
            "FROM user_base_info " +
            "where 1=1 " +
            "and id = #{id} " +
            "and status = #{status} "
    )
    UserBaseInfo selectPersonalInterfaceInfo(Long id,String status);
}
